package com.ruoyi.business.tool;

import com.ruoyi.business.service.impl.AcAssetInfoServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import java.util.Random;

@Service
@Component
public class AssetInfoTool {

    @Autowired
    private AcAssetInfoServiceImpl acAssetInfoService;

    /**
     * 随机生成6位正整数
     *
     * **/
    public Long generateRandomNumber() {
        Random random = new Random();
        return 100000L + random.nextInt(900000);  // 生成 100000 - 999999 之间的随机数
    }

    /**
     * 资产状态定时器
     * **/
    @Scheduled(cron = "0 0 0 * * ?")  // 每天00：00：00执行
    // 一小时秒执行
    @Scheduled(cron = "0 0 * * * ?")
    public void updateAcAssetInfoByAssetStatus() {
        acAssetInfoService.updateAcAssetInfoByAssetStatus();
    }

}
